<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>用户管理</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		
		<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">		
		<script type="text/javascript" charset="utf-8" src="extjs/ext-all.js"></script>
		<script type="text/javascript" charset="utf-8" src="extjs/locale/ext-lang-zh_CN.js"></script>
		
		<link rel="stylesheet" href="res/css/list.css" type="text/css" />
		<script type="text/javascript" src="res/js/util.js"></script>
		<script type="text/javascript" src="user/js/user.js"></script>
	</head>

	<body>
		<form name="form" method="post" action="user/loadUsers.action?nodeId=6&nodeText=${nodeText }" onsubmit="return check();">
			<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"
				bordercolor="#799AE1" class="tableBorder">
				<tbody>
					<tr>
						<th align="center" colspan="12" style="height:23px;text-align: center;">
							<s:property value="nodeText" />
						</th>
					</tr>
					<tr bgcolor="#DEE5FA">
						<td colspan="12" align="left" class="txlrow">
							<img alt="新增" src="res/images/add.gif">&nbsp;&nbsp;<!-- <a href="javascript:showAddForm();">新增</a> -->
							<a style="color:red;" href="javascript:showBatchAddForm();">批量导入</a>
						</td>
					</tr>
					<tr align="center" bgcolor="#799AE1">
						<td width="2%" align="center" class=txlHeaderBackgroundAlternate>
							选定
						</td>
						<td width="4%" align="center" class="txlHeaderBackgroundAlternate">
							用户名
						</td>
						<!-- 
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							昵称
						</td>
						 -->
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							真实姓名
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							所属用户组
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							系部/部门
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							考研室/专业
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							年级
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							班级
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							注册时间
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							最后登录时间
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							用户状态
						</td>
						<td width="10%" align="center" class=txlHeaderBackgroundAlternate>
							操作
						</td>
					</tr>
					<s:if test="accounts==null || accounts.size() == 0">
						<tr bgcolor="#DEE5FA">
							<td colspan="8" align="center" class="txlrow">暂无数据！</td>
						</tr>
					</s:if>
					<s:else>
						<s:iterator value="accounts">
							<tr bgcolor="#DEE5FA">
								<td align=center class=txlrow>
									<input type="checkbox" name="chk" value="<s:property value='user.id' />">
								</td>
								<td align="center" class="txlrow">
									<s:property value="user.loginName" /><input type="hidden" value="<s:property value='user.loginName' />" id="<s:property value='user.id' />loginName" />
								</td>
								<!-- 
								<td align=center class=txlrow>
									<s:property value="user.nickname" /><input type="hidden" value="<s:property value='user.loginName' />" id="<s:property value='user.id' />" />
								</td>
								 -->
								<td align=center class=txlrow>
									<s:property value="user.realName" /><input type="hidden" value="<s:property value='user.realName' />" id="<s:property value='user.id' />realName" />
								</td>
								<td align=center class=txlrow>
									<s:if test="group != null">
										<s:property value="group.groupName" /><input type="hidden" value="<s:property value='group.id' />" id="<s:property value='user.id' />groupId" />
									</s:if>
									<s:else>
										游客注册<input type="hidden" value="游客注册" id="<s:property value='user.id' />groupId" />
									</s:else>
								</td>
								<td align=center class=txlrow>
									<s:property value="department.name" /><input type="hidden" value="<s:property value='department.name' />" id="<s:property value='user.id' />department" />
								</td>
								<td align=center class=txlrow>
									<s:property value="professional.name" /><input type="hidden" value="<s:property value='professional.name' />" id="<s:property value='user.id' />professional" />
								</td>
								<td align=center class=txlrow>
									<s:property value="grade.name" /><input type="hidden" value="<s:property value='grade.name' />" id="<s:property value='user.id' />grade" />
								</td>
								<td align=center class=txlrow>
									<s:property value="clazz.name" /><input type="hidden" value="<s:property value='clazz.name' />" id="<s:property value='user.id' />clazz" />
								</td>
								<td align="center" class="txlrow">
									<s:property value="regTime" />
								</td>
								<td align=center class=txlrow>
									<s:property value="lastLoginTime" />
								</td>
								<td align=center class=txlrow>
									<s:if test="user.isAudit == 0"><a style="color:gray;"><img alt="待审核" src="res/images/lock.png">待审核</a></s:if>
									<s:if test="user.isAudit == 1"><a style="color:red;"><img alt="审核通过" src="res/images/unlock.png">审核通过</a></s:if>
									<s:if test="user.isAudit == 2"><a style="color:orange;"><img alt="审核未通过" src="res/images/lock.png">审核未通过</a></s:if>
									<input type="hidden" value="<s:property value='user.isAudit' />" id="<s:property value='user.id' />audit" />
								</td>
								<td align=center class=txlrow>
									<img alt="审核" src="res/images/lock.png">&nbsp;<a href="javascript:showAuditForm(<s:property value='user.id' />);">审核</a>
									
									<img alt="修改" src="res/images/edit.gif">&nbsp;<a href="<%=basePath %>user/loadUserInfo.action?user.id=<s:property value='user.id' />" target="_blank">修改</a>
									<img alt="删除" src="res/images/delete.gif">&nbsp;<a href="javascript:deleteCmd(<s:property value='user.id' />);">删除</a>
								</td>
							</tr>
						</s:iterator>
					</s:else>
					<tr bgcolor="#DEE5FA">
						<td colspan="8" align="center" bgcolor="#DEE5FA" class="txlrow">
							<s:if test="pageBean == null">
							</s:if>
							<s:else>
								<input type="hidden" id="pageBean.currPage" name="pageBean.currPage" value="${pageBean.currPage}" />
								<input type="hidden" id="pageBean.totalPage" name="pageBean.totalPage" value="${pageBean.totalPage}" />
								<a href="javascript:skipPage(${pageBean.currPage - 1 });">上一页</a>&nbsp;&nbsp;
								第
								<select id="currPage" name="currPage" onchange="javascript:skipPage(this.value);">
									<c:if test="${pageBean.totalPage eq 0}">
										<option value="1">1</option>
									</c:if>
									<c:forEach begin="1" end="${pageBean.totalPage }" step="1"
											var="pageNum">
											<option value="${pageNum}"  <c:if test="${pageBean.currPage == pageNum }"> selected="selected"</c:if>>${pageNum}</option>
									</c:forEach>
								</select>
								页
								<a href="javascript:skipPage(${pageBean.currPage + 1 });">下一页</a>&nbsp;&nbsp;
								共
								<c:choose>
									<c:when test="${pageBean.totalPage eq 0}">
										1
									</c:when>
									<c:otherwise>
										${pageBean.totalPage}
									</c:otherwise>
								</c:choose>
								页
							</s:else>
						</td>
						<td colspan="4" align="center" bgcolor="#DEE5FA" class="txlrow">
							<span class="tablebody2">
								<input type="button" value="全选" name="Submit2" onClick="selectAll()" />
								<input type="button" value="取消全选" name="Submit2" onClick="unSelectAll();" />
								<input type="button" value="批量删除" name="Submit2" onClick="batchDel();" />
							</span>
							<input type="submit" name="ok" value="确定" class="but">
						</td>
					</tr>
				</tbody>
			</table>
		</FORM>
	</body>
</html>
